Tinfo.getsubtype ()) {//If 2g type case TELEPHONYMANAGER.NETWORK_TYPE_GPRS://Unicom 2g TELEPHONYMANAGER.NETWORK_TYPE_CD MA://Telecom 2g Case Telephonymanager.network_type_edge://Mobile 2g Case TelephonyManager.NETWORK_TYPE_1xRTT:case Telephonyma Nager. Network_type_ideN:return networn_2g; If it is a 3g type case TELEPHONYMANAGER.NETWORK_TYPE_EVDO_A://Telecom 3g TelephonyManager.NETWORK_TYPE_UMTS:case Telephonyma Nager. Network_type_evdo_0:case TelephonyManager.NETWORK_TYPE_HSDPA:case TelephonyM
This example for you to share the Android decision is WiFi or 4G network code for your reference, the specific content as follows
Package com.chengxinet.bobo.utils;
Import Android.content.Context;
Import Android.net.ConnectivityManager;
Import Android.net.NetworkInfo;
Import Android.telephony.TelephonyManager;
/** * Created by the Administrator on 2016/1/7. */public class Networkutils {public stati
Android system transplantation and debugging -------) how to modify the number of 4G signal strength grids displayed on Android phones
Before modifying the displayed signal strength, let's take a look at what is dB and what is dBm?
1. dBDB is a value that represents relative values. A pure ratio represents only the relative size relationship between two quantitie
programming courses onlineHere's the full difference between ARC vs garbage Collection2. User InterfaceAn Android user often complains on phone lag but the IOS UI runs so smooth. The main reason is and the IOS UI rendering happens in a separate thread with real-time priority and on Android, this hap The pens in the main is thread with a normal priority. This means that other apps in
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/8C/66/wKioL1hrlE7S5bMTAAX6Oyymcss807.png-wh_500x0-wm_3 -wmp_4-s_404568705.png "title=" Qq20170103192134.png "alt=" Wkiol1hrle7s5bmtaax6oyymcss807.png-wh_50 "/>For those who like to toss a hammer T series of real unwise choice, but I am luo powder, for the Hammer Android kernel version of the non-upgrade policy is very dissatisfied, I admit that Smartisan OS is really good, with the iOS after t
Many times it is necessary to determine the current user's network before proceeding with some of the processing logic. But the network type gets this piece, I am using my own mobile phone to debug some problems, here to record.
A mobile phone generation, mobile 4G network, get the subtype type value of 17, I checked the Android 5.1 source code, its maximum value is 16.
I take the Phantom's mobile
Network_type_ltecurrent Network is lteconstant value:13 (0x0000000d) (4G) public static final int Network_type_ Ehrpdcurrent Network is ehrpdconstant value:14 (0x0000000e) 3G (3G to 4G upgrade product)--------------------------Added in API level---------------------------public static final int Network_type_hspapcurrent Network is hspa+constant value:15 (0x0000000f) (3G)So we can networkinfo.getsubtype ()
Android Network-determine the Network status (Network connection, change, and determine 2G/3G/4G)
Currently, most apps need to obtain data from the network. Therefore, it is inevitable to access the network. Before accessing the network, we should first determine the network status. In fact, before accessing the network, we need to make some status judgments and corresponding status judgments for processing
Obtain the current network type (2g, 3g, 4g, wifi), mobile phone model, and version number of Android.Obtain the mobile phone model: android. OS. build. MODEL: android. OS. build. VERSION. the code used to obtain the current network type of the mobile phone is as follows: This is a tool class, which can be saved for easy use.
Package com. iqtogether. qxueyou. sup
need for permissionsandroid.permission.ACCESS_FINE_LOCATIONLet's look at how to get the current device to open the positioning mode, the passive mode is automatically opened, mixed mode is the network mode and GPS mode are open, the advantages of this mode is: Short positioning time, high precision. Cons: Fee Electricity//0 means passive Mode 1 means network Mode 2 means GPS mode 3 means mixed mode Public Static int Getlocationmode(Context context) {BooleanNetwork =false;BooleanGPS =false;
Requirement: count the number of Wi-Fi/2G/3G/4G traffic
Issue:
1. How to Determine 2G/3G/4G
The system source code TelephonyManager class provides methods, but only hidden, so you can refer to the source code
Ii. How to make statistics
The TrafficStats class is provided after Android 2.2 for traffic statistics. For more information, see the manual.
Here I used
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.